<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Web防火墙日志监控</title>
    <style>
        body {
            font-family: 'Arial', sans-serif;
            margin: 0;
            padding: 20px;
            background-color: #f5f5f5;
        }
        .container {
            max-width: 1200px;
            margin: 0 auto;
            background-color: white;
            border-radius: 8px;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
            padding: 20px;
        }
        h1 {
            color: #333;
            text-align: center;
            margin-bottom: 20px;
        }
        .controls {
            margin-bottom: 20px;
            display: flex;
            gap: 10px;
        }
        button {
            padding: 8px 16px;
            background-color: #4CAF50;
            color: white;
            border: none;
            border-radius: 4px;
            cursor: pointer;
        }
        button:hover {
            background-color: #45a049;
        }
        button:disabled {
            background-color: #cccccc;
            cursor: not-allowed;
        }
        #status {
            padding: 8px;
            border-radius: 4px;
            margin-left: auto;
        }
        .connected {
            background-color: #dff0d8;
            color: #3c763d;
        }
        .disconnected {
            background-color: #f2dede;
            color: #a94442;
        }
        table {
            width: 100%;
            border-collapse: collapse;
        }
        th, td {
            padding: 12px 15px;
            text-align: left;
            border-bottom: 1px solid #ddd;
        }
        th {
            background-color: #f8f8f8;
            position: sticky;
            top: 0;
        }
        tr:hover {
            background-color: #f5f5f5;
        }
        .success {
            color: #3c763d;
        }
        .warning {
            color: #8a6d3b;
        }
        .danger {
            color: #a94442;
        }
        .filter-controls {
            margin-bottom: 15px;
            display: flex;
            flex-wrap: wrap;
            gap: 10px;
        }
        .filter-controls input, .filter-controls select {
            padding: 8px;
            border: 1px solid #ddd;
            border-radius: 4px;
        }
        .pagination {
            display: flex;
            justify-content: center;
            margin-top: 20px;
            gap: 5px;
        }
        .pagination button {
            min-width: 40px;
        }
    </style>
</head>
<body>
    <div class="container">
        <h1>Web防火墙日志监控</h1>
        
        <div class="controls">
            <button id="connectBtn">连接</button>
            <button id="disconnectBtn" disabled>断开</button>
            <button id="clearBtn">清空日志</button>
            <span id="status" class="disconnected">未连接</span>
        </div>
        
        <div class="filter-controls">
            <input type="text" id="ipFilter" placeholder="过滤IP地址">
            <input type="text" id="methodFilter" placeholder="过滤HTTP方法">
            <input type="text" id="uriFilter" placeholder="过滤URI">
            <select id="resultFilter">
                <option value="">所有结果</option>
                <option value="ALLOW">允许</option>
                <option value="BLOCK">拦截</option>
            </select>
            <input type="text" id="portFilter" placeholder="过滤端口">
        </div>
        
        <div class="table-container">
            <table id="logTable">
                <thead>
                    <tr>
                        <th>时间戳</th>
                        <th>客户端IP</th>
                        <th>方法</th>
                        <th>URI</th>
                        <th>端口</th>
                        <th>结果</th>
                    </tr>
                </thead>
                <tbody id="logBody">
                    <!-- 日志将在这里动态添加 -->
                </tbody>
            </table>
        </div>
        
        <div class="pagination">
            <button id="prevPage" disabled>上一页</button>
            <span id="pageInfo">第 1 页</span>
            <button id="nextPage" disabled>下一页</button>
        </div>
    </div>

    <script src="app.js"></script>
</body>
</html>